(setf *rule1*
      '(=> (and	(has-untreated-injury ?Patient ?Injury1)
	    (has-untreated-injury ?Patient ?Injury2)
	    (injury-worse-than ?Injury1 ?Injury2)
	    (intention (stabilize-injury ?Injury1)) 
	    (intention (stabilize-injury ?Injury2)) 
	    (goal (stabilized-injuries ?Patient)))
	(intention (stabilize-injuries ?Patient))))

(setf *rule2*
      '(=> (and	(has-untreated-injury ?Patient ?Injury1)
	    (has-untreated-injury ?Patient ?Injury2)
	    (injury-worse-than ?Injury1 ?Injury2)
	    (intention (stabilize-injury ?Injury1)) 
	    (intention (stabilize-injury ?Injury2)) 
	    (goal (stabilized-injuries ?Patient)))
	(intention (stabilize-injuries ?Patient))))

(setf *rule3*
      '(=> (and	(bleeding ?Injury)
	    (item-available ?Item )
	    (tourniquet ?Item)
	    (intention (stop-bleeding-with ?Injury ?Item))
	    (goal (stabilized-injury ?Injury)))
	(intention (stabilize-injury ?Injury))))

(setf *rule4*
      '(=> (and (goal (stabilized-patient ?Patient))
	    (injured ?Patient)
	    (intention  (stabilize-injuries ?Patient)))
	(intention (stabilize-patient ?Patient))))

(setf *medrules* (list *rule1* *rule2* *rule3* *rule4*))

		
(setf *s1*
      '((has-untreated-injury p1 i1)
	(has-untreated-injury p1 i2)
	(injury-worse-than i1 i2)
	(intention (stabilize-injuries p1))))
	  
; expected output
;
;	(goal (stabilized-injuries p1)))
;	(intention (stabilize-injury i1))
;	(intention (stabilize-injury i2))

(setf *s2*
      '((bleeding i1)
	(tourniquet t1)
	(intention (stop-bleeding-with i1 t1))
	(intention (stabilize-injury i1))))

; OUTPUT:
; (goal (stabilized-injury i1))
; (item-available i1)

(setf *s3*
      '((injured p1)))

; OUTPUT
; (goal (stabilized-patient p1))
; (intention (stabilized-injuries p1))
; (intention (stabilize-patient p1))

(setf *sfull* (funcall #'append *s1* *s2* *s3*))

(setf *s13* (funcall #'append *s1* *s3*))
